/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.zjdt.epserver.db.service4mysql;

import com.zjdt.epserver.db.dao.ProductDao;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;

/**
 *
 * @author dusin
 */
public class ProductServiceImpl {
    static Logger logger = Logger.getLogger(ProductServiceImpl.class);
    ProductDao productDao;

    public ProductServiceImpl(ProductDao productDao) {
        this.productDao = productDao;
    } 
     
    public List<Map<String,Object>> findAllPaper(){
        return productDao.findAllPaper();
    }
    public List<Map<String,Object>> findAllSteel(){
        return productDao.findAllSteel();
    }
     
    public List<Map<String,Object>> findAllPaperFuzzy(String key){
        return productDao.findAllPaperFuzzy(key);
    }
    
    public List<Map<String,Object>> findAllByFactory(String factoryCode){
        return productDao.findAllByFactory(factoryCode);
    }
    
    public List<Map<String,Object>> findAllSteelFuzzy(String key){
        return productDao.findAllSteelFuzzy(key);
    }
    
     public boolean create(String code,String name,String note,String factoryCode){
        return productDao.doCreate(new Object[]{code,name,note,factoryCode}); //
    }
    
    public boolean update(int id,String code,String name,String note){
        return productDao.doUpdateById(new Object[]{code,name,note,id});
    }    
    
   
    public boolean remove(int id){
        return productDao.doDeleteById(id);
    }
}
